const eventBus = {
	callbacks: {}
}
eventBus.on = function (type, callback) {
	if (this.callbacks[type]) {
		this.callbacks[type].push(callback);
	} else {
		this.callbacks[type] = [callback];
	}
}
eventBus.emit = function (type, data) {
	let callbacks = this.callbacks[type];
	if (callbacks && callbacks > 0) {
		callbacks.forEach(callback => {
			callback(data);
		})
	}
}
eventBus.off = function (eventName) {
	if (eventName) {
		delete this.callbacks[eventName]
	} else {
		this.callbacks = {};
	}
}
